<?php
class index extends control
{
    /* 构造函数。*/
    public function __construct()
    {
        parent::__construct('');
    }

    /* index方法，也是默认的方法。*/
    public function index()
    {
       // $header['title'] = $this->lang->welcome;
       // $this->assign('header',  $header);
//        $this->assign('content', $this->lang->content);
        $this->assign('incjs', 'index');
		$this->loadModel('info');
		$this->assign('mod_info5', $this->info->mod_first5());
        $this->display();
    }
    
    public function search(){
    	
    	$this->assign('content', 'search');
    	$this->display('about', 'index');
    }
    
    public function get(){
    	$params = helper::filterParams();
    	$id = (int)$params['id'];
    	$data = '';
    	if($id){
    		$data = $this->demo->get($id);
    	}
    	$this->assign('data', $data);
    	$this->display();
    }
    
    public function client(){
    	$this->display();
    }
    public function design(){
    	$this->display();
    }
    
    public function yzm(){
    	$this->app->loadClass('yzm');
		    	
		$createStr = new yzm;
		
		$number = $createStr->createRandomStr('4');//��֤���λ��
		$number_len = strlen($number);
		$_SESSION["VAL_CODE"] = $number;
		
		$img_width = 60;
		$img_height = 20;
		
		$img = imageCreate($img_width, $img_height);
		ImageColorAllocate($img, 0x6C, 0x74, 0x70);
		$white = ImageColorAllocate($img, 0xff, 0xff, 0xff);
		
		$ix = 6;
		$iy = 2;
		for ($i = 0; $i < $number_len; $i++) {
		    imageString($img, 5, $ix, $iy, $number[$i], $white);
		    $ix += 14;
		}
		for($i=0;$i<200;$i++)   //����������� 
		{
		    $randcolor = ImageColorallocate($img,rand(0,255),rand(0,255),rand(0,255));
		    imagesetpixel($img, rand()%100 , rand()%50 , $randcolor);
		}
		
		header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG));
		
		imagepng($img);
		imagedestroy($img);

    }
}
